<div>
    <ol class="breadcrumb" >
        <li> <i class="fa fa-anchor"></i>
            &nbsp;接口参数管理
        </li>
        <li>参数列表</li>
        <li style="float:right"><a href="#" class="localRgihtBt" onClick="ShowHide('addvar')"><b> 添加接口参数</b></a></li>
    </ol>
    <div class="panel">

   <div id="addvar" style="display:none">
   <td height="24" bgcolor="#ffffff" align="center">
   <form name="fadd" action="{:U("Interfaceparam/add")}" method="post">
      
     <table width="98%" border="0" cellspacing="0" cellpadding="0">
      <tr>
       <td align="right" width="20%" height="26">参数名称：</td>
       <td width="30%" align="left"><input name="param_name" type="text"  style="width:100%" /></td>
       <td width="20%" align="right">变量值：</td>
       <td width="30%" align="left"><input name="param_value" type="text" id="param_value" style="width:100%" /></td>
      </tr>

      <tr>
       <td align="right" height="26">参数说明：</td>
       <td align="right">
       		<textarea name="description" rows="3" cols="20">

			</textarea>
       
       </td>


       <td align="right">
        <input type="submit" name="Submit" value="保存"  /></td>
      </tr>
     </table>
    </form>
  </div>
        
        
        
        
        <table  class="table table-bordered table-striped table-mcit" >

            <thead>
            <tr>
                <th>
                    <button class='btn btn-block btn-mcit' type="button" name="" value="">选择</button>
                </th>
                <th >
                    <button class='btn btn-block btn-mcit' type="button" name="" value="">ID</button>
                </th>
                <th>
                    <button class='btn btn-block btn-mcit' type="button" name="" value="">参数名称</button>
                </th>
                
                <th>
                    <button class='btn btn-block btn-mcit' type="button" name="" value="">参数值</button>
                </th>
                
                
                <th>
                    <button class='btn btn-block btn-mcit' type="button" name="" value="">参数说明</button>
                </th>
                
                <th>
                    <button class='btn btn-block btn-mcit' type="button" name="" value="">操作</button>
                </th>
            </tr>
            </thead>
            

            
            <tbody id="DataTableContent">
            <empty name="char_param_config">
                <td colspan="99" style="text-align:center" class="danger"> <strong><i class="fa fa-meh-o"></i>
                    &nbsp;&nbsp;当前条件下没有数据</strong>
                </td>
                <else />
                <volist name="char_param_config" id="data">
                    <tr class="lists" align="center">
                        <td><input type="checkbox"  value="{$data.id}"/></td>
                        <td>{$data.id}</td>

                        
                        <td title="{$data.param_name}">{$data.param_name}</td>
                  		<td title="{$data.param_value}">{$data.param_value}</td>
                        <td title="{$data.description}">{$data.description}</td>

                        <td>
                            <a class="btn btn-success btn-sm" href="__URL__/detail/id/{$data.id}">
                                <i class="fa fa-eye"></i>
                                &nbsp;查看
                            </a>
                            <a class="btn btn-warning btn-sm" href="__URL__/update/id/{$data.id}">
                                <i class="fa fa-edit"></i>
                                &nbsp;修改
                            </a>
                            <if condition="$_SESSION['role'] eq 805 || $_SESSION['role'] eq 802">
                                <a class="btn btn-sm btn-danger deleteBtn" href="#confirmDelete" data-target="#confirmDelete" data-toggle="modal" data-id='{$data.id}'><i class="fa fa-trash-o"></i>
                                &nbsp;删除</a>
                            <else /></if>
                        </td>
                    </tr>
                </volist>
            </empty>
            <tr>
                <td colspan="99">
                    <input type="button" value="全选"   class="btn" id="selectAll">
                    <input type="button" value="全不选" class="btn" id="unSelect">
                    <input type="button" value="反选"   class="btn" id="reverse">
                     
                    <input type="button" value="批量删除" class="btn" id="getValues">
                </td>
            </tr>
            <tr>
                <td colspan="99" style="text-align:center">
                    <ul class="pagination">{$pageView}</ul>
                </td>
            </tr>
            </tbody>
        </table>
    </div>
</div>
        <div id="ss" style="width:200px;height:100px;background-color:#;display: none">asd</div>
<!-- 删除分类 -->
<div id="confirmDelete" class="modal  fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"
     aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
                <h4 id="myModalLabel">是否确认删除？</h4>
            </div>
            <div class="modal-body" style="color: #D2322D">
                注意！删除后将不可恢复。
            </div>
            <div class="modal-footer">
                <a class="btn" data-dismiss="modal" aria-hidden="true" id="modelClose">关闭</a>
                <a class="btn btn-primary" id="confirmDeleteBtn">确定</a>
            </div>
        </div></div>
    <div class="hide" id="cache">1</div>
</div>
<import file="js.jquery#chained" />
<script type="text/javascript">
    $(document).ready(function () {

 

        $("#location-s").chained("#location-f");
        $("#location-t").chained("#location-s");

        $(".deleteBtn").click(function (){
            var id = $(this).attr("data-id");
            $("#cache").val(id);
        });
        $("#confirmDeleteBtn").click(function (){
            var id = $("#cache").val();
            //alert(id);
            $.ajax({
                type:"get",
                url:'__URL__/del',
                data:'id='+id,
                success:function(data){
                    if(data == 1){
                        alertify.success("删除成功！");
                    }else{
                        alertify.error("删除失败，请重新提交！");
                    }
                    location.reload();
                }
            });
        });

        //全选
        $("#selectAll").click(function () {
            $(".lists :checkbox").prop("checked", true);
        });
        //全不选
        $("#unSelect").click(function () {
            $(".lists :checkbox").prop("checked", false);
        });
        //反选
        $("#reverse").click(function () {
            $(".lists :checkbox").each(function () {
                $(this).prop("checked", !$(this).prop("checked"));
            });
        });

        //批量删除
        $("#getValues").click(function(){
            var valArray = new Array;
            $("input[type='checkbox']:checked").prop("checked", function(i) {
                valArray[i] = $(this).val();
            });
            var values = valArray.join(',');
            if(values == ''){
                alert("请选择要处理的数据!");
            }else{
                //alert(values);
                alertify.confirm("确定删除吗？", function (e) {
                    if (e) {
                        $.ajax({
                            type: "POST",
                            url:  '{:U("Interfaceparam/del")}',
                            data: {charids:values},
                            dataType: "json",
                            success: function(data){
                                if(data.state==100){
                                    alertify.success(data.msg);
                                }else{
                                    alertify.error(data.msg);
                                }
                                location.reload();
                            }
                        });
                    } else {
                        alertify.error("取消操作！");
                    }
                }, "mcit_default");
            }
        });
    });
</script>



<script language="javascript">
var searchconfig = false;
function Nav()
{
	if(window.navigator.userAgent.indexOf("MSIE")>=1) return 'IE';
	else if(window.navigator.userAgent.indexOf("Firefox")>=1) return 'FF';
	else return "OT";
}
function $Obj(objname)
{
	return document.getElementById(objname);
}
function ShowConfig(em,allgr)
{
	if(searchconfig) location.reload();
	for(var i=1;i<=allgr;i++)
	{
		if(i==em) $Obj('td'+i).style.display = (Nav()=='IE' ? 'block' : 'table');
		else $Obj('td'+i).style.display = 'none';
	}
	$Obj('addvar').style.display = 'none';
}

function ShowHide(objname)
{
	var obj = $Obj(objname);
	if(obj.style.display != "none") obj.style.display = "none";
	else obj.style.display = (Nav()=='IE' ? 'block' : 'table-row');
}



</script>